import java.util.Scanner;

public class test7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数组个数:");
        int n = sc.nextInt();
        System.out.println("请输入数组的各个数据:");
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        getSingle(arr);
    }
    public static void getSingle(int[] arr){
        System.out.println("重复的数为:");
        int count = 0;
        int temp = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (count ==0 ){
                temp = arr[i];
            }
            if (temp == arr[i]){
                count++;
            } else {
                count--;
            }

        }
        System.out.println(temp);
    }
}